package com.luzj.service;

import com.luzj.entity.User;
import com.luzj.mapper.UserMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

/**
 * Created by Administrator on 2016/9/9.
 */
@Service
public class UserService {
    @Autowired
    private UserMapper userMapper;
    public List<User> getUserInfo(){
        HashMap<String,String> param = new HashMap<>();
        String id ="233";
        param.put("id",String.valueOf(id));
         List<User> users =userMapper.findUserInfo(param);
        return users;
    }
    public List<User> deleteUserInfo(){
        userMapper.deleteUserInfo();
        return getUserInfo();
    }

    public List<User> insertUserInfo(){
        String id=String.valueOf(Math.round(Math.random()*200)),
                name = "zhangqq";
        HashMap<String,String> param = new HashMap<>();
        param.put("id",id);
        param.put("name",name);
        userMapper.insertUserInfo(param);
        return getUserInfo();
    }

    public List<User> updateUserInfo(){
        userMapper.updateUserInfo();
        return getUserInfo();
    }

}
